<template>
    <div class="warehourse-position-page">
        <el-form :inline="true" :model="whPositionForm" class="demo-form-inline" style="border-bottom:1px solid #ccc;">
            <el-form-item label="库位编码" class="selectMB10">
                <el-input size="mini" v-model="whPositionForm.code" placeholder="请输入库位编码"></el-input>
            </el-form-item>
            <el-form-item label="库位名称" class="selectMB10">
                <el-input size="mini" v-model="whPositionForm.name" placeholder="请输入库位名称"></el-input>
            </el-form-item>
            <el-form-item label="库区编码" class="selectMB10">
                <el-input size="mini" v-model="whPositionForm.areaCode" placeholder="请输入库区编码"></el-input>
            </el-form-item>
            <el-form-item label="库区名称" class="selectMB10">
                <el-input size="mini" v-model="whPositionForm.areaName" placeholder="请输入库区名称"></el-input>
            </el-form-item>
            <el-form-item label="库房编码" class="selectMB10">
                <el-input size="mini" v-model="whPositionForm.roomCode" placeholder="请输入库房编码"></el-input>
            </el-form-item>
            <el-form-item label="库房名称" class="selectMB10">
                <el-input size="mini" v-model="whPositionForm.roomName" placeholder="请输入库房名称"></el-input>
            </el-form-item>
             <el-form-item label="当前状态" class="selectMB10" style="margin-right: 10px;">
                <el-select size="mini" clearable v-model="whPositionForm.status" placeholder="请选择">
                    <el-option v-for="(status,index) in statusLists" :key="index" :label="status.label" :value="status.value"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item class="selectMB10">
                <el-button class="bolder outsideBtnBS selectAll" :disabled="selectDisabled" size="mini" type="danger" @click="querywhPosition()">查询</el-button>
            </el-form-item>
        </el-form>
        <!--表格-->
        <label class="default-label">库区明细列表：</label>
        <!--新增按钮-->
        <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="createNew()">新增</el-button>
        <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="importFile">导入</el-button>
        <el-table :data="whPositionData" border style="width: 100%;" v-loading.body="loading" element-loading-text="拼命加载中">
            <el-table-column type="index" header-align="center" align="center" label="序"  width="40"></el-table-column>
            <el-table-column label="操作" header-align="center" align="center" width="100">
                <template scope="scope">
                    <div class="operationItem bolder" v-if="scope.row.status" @click="handleStatus(scope.$index,scope.row)">禁用</div>
                    <div class="operationItem bolder" v-else @click="handleStatus(scope.$index,scope.row)">启用</div> 
                    <div class="operationItem disabled bolder" v-if="scope.row.status">修改</div>
                    <div class="operationItem bolder" v-else @click="handleUpdate(scope.$index,scope.row)">修改</div>
                </template>
            </el-table-column>
            <el-table-column prop="statusName" label="状态" :formatter="stateChange" header-align="center" align="center" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column prop="code" label="库位编码" header-align="center" width="100" show-overflow-tooltip></el-table-column>
            <el-table-column prop="name" label="库位名称" header-align="center" show-overflow-tooltip></el-table-column>
            <el-table-column prop="areaCode" label="库区编码" header-align="center" width="100" show-overflow-tooltip></el-table-column>
            <el-table-column prop="areaName" label="库区名称" header-align="center" show-overflow-tooltip></el-table-column>
            <el-table-column prop="areaRemark" label="库区描述" header-align="center" show-overflow-tooltip></el-table-column>
            <el-table-column prop="roomCode" label="库房编码" header-align="center" width="100" show-overflow-tooltip></el-table-column>
            <el-table-column prop="roomName" label="库房名称" header-align="center" show-overflow-tooltip></el-table-column>
            <el-table-column prop="roomRemark" label="库房描述" header-align="center" show-overflow-tooltip></el-table-column>
        </el-table>
        <!--分页-->
        <el-pagination v-if="isPaging" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageIndex"  :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :page-count="totalPage" :total="totalNumber"></el-pagination>
         <!--新建弹窗-->
        <el-dialog title="新增库位信息" :visible.sync="dialogForm1Visible" size="small" :lock-scroll="false">
            <el-form :inline="true" :model="addWhPositionForm" class="demo-form-inline" style="border-bottom:1px solid #ccc;" ref="addWhPositionForm"> 
                <el-form-item label="库房编码" prop="roomCode"  :rules="[{ required: true, message: '库房编码不能为空'},{ max: 20, message: '最多不可超过20字符'}]" :label-width="labelWidth">
                    <el-select v-model="addWhPositionForm.roomCode" @change="selectedroomCode">
                        <el-option v-for="(wareHouseMesg,index) in wareHouseMesgLists" :key="index" :label="wareHouseMesg.code" :value="wareHouseMesg.code"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="库房名称" :label-width="labelWidth">
                    <el-input  v-model.trim="addWhPositionForm.roomName" placeholder="请输入库房名称" disabled></el-input>
                </el-form-item>
                <el-form-item label="库区编码" prop="areaCode"  :rules="[{ required: true, message: '库区编码不能为空'},{ max: 20, message: '最多不可超过20字符'}]" :label-width="labelWidth">
                    <el-select v-model="addWhPositionForm.areaCode" @change="selectedareaCode">
                        <el-option v-for="(storageSectionMesg,index) in storageSectionMesgLists" :key="index" :label="storageSectionMesg.code" :value="storageSectionMesg.code"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="库区名称" :label-width="labelWidth">
                    <el-input  v-model.trim="addWhPositionForm.areaName" placeholder="请输入库区名称" disabled></el-input>
                </el-form-item>
            </el-form>
            <!--表格-->
            <label class="default-label">库位明细列表：</label>
            <!--新增按钮-->
            <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="handleAddCreate">新增</el-button>
            <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="handleAddSave">保存</el-button>
            <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="handleAddSAE">保存并退出</el-button>
            <el-table :data="addWhPositionData" border style="width: 100%;">
                <el-table-column type="index" header-align="center" align="center" label="序"  width="40"></el-table-column>
                <el-table-column label="操作" header-align="center" align="center" width="50">
                    <template scope="scope">
                        <div class="operationItem bolder"  @click="handleAddDel()">删除</div>
                    </template>
                </el-table-column>
                <el-table-column prop="code" label="库位编码" header-align="center" show-overflow-tooltip>
                    <template scope="scope">
                        <el-input size="mini" class="code" v-model.number="scope.row.code" placeholder="请输入库位编码" v-if="scope.row.id" disabled></el-input>
                        <el-input size="mini" class="code" v-model.number="scope.row.code" placeholder="请输入库位编码" v-else></el-input>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="库位名称" header-align="center" show-overflow-tooltip>
                    <template scope="scope">
                        <el-input size="mini" class="name" v-model.number="scope.row.name" placeholder="请输入库位名称" v-if="scope.row.id" disabled></el-input>
                        <el-input size="mini" class="name" v-model.number="scope.row.name" placeholder="请输入库位名称" v-else></el-input>
                    </template>
                </el-table-column>
            </el-table>
        </el-dialog>
        <!--修改弹窗-->
        <el-dialog title="修改库位库位" :visible.sync="dialogForm2Visible" size="small" :lock-scroll="false">
            <el-form :inline="true" :model="updateWhPositionForm" class="demo-form-inline" style="border-bottom:1px solid #ccc;" ref="updateWhPositionForm">
                <el-form-item label="库位编码" :label-width="labelWidth">
                    <el-input  v-model.trim="updateWhPositionForm.code" disabled></el-input>
                </el-form-item>
                <el-form-item label="库位名称" prop="name"  :rules="[{ required: true, message: '库位名称不能为空'},{ max: 200, message: '最多不可超过200字符'}]" :label-width="labelWidth">
                    <el-input  v-model.trim="updateWhPositionForm.name" :title="updateWhPositionForm.name"></el-input>
                </el-form-item>
                <el-form-item label="库区编码" :label-width="labelWidth">
                    <el-input  v-model.trim="updateWhPositionForm.areaCode" placeholder="请输入库区编码" disabled></el-input>
                </el-form-item>
                <el-form-item label="库区名称" :label-width="labelWidth">
                    <el-input  v-model.trim="updateWhPositionForm.areaName" placeholder="请输入库区名称" disabled></el-input>
                </el-form-item>
                <el-form-item label="库区描述" :label-width="labelWidth">
                    <el-input  v-model="updateWhPositionForm.areaRemark" placeholder="请输入库区描述" disabled></el-input>
                </el-form-item>
                 <el-form-item label="库房编码" :label-width="labelWidth">
                    <el-input  v-model.trim="updateWhPositionForm.roomCode" placeholder="请输入库房编码" disabled></el-input>
                </el-form-item>
                <el-form-item label="库房名称" :label-width="labelWidth">
                    <el-input  v-model.trim="updateWhPositionForm.roomName" placeholder="请输入库房名称" disabled></el-input>
                </el-form-item>
                <el-form-item label="库房描述" :label-width="labelWidth">
                    <el-input  v-model="updateWhPositionForm.roomRemark" placeholder="请输入库房描述" disabled></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="handleUpdateSave">确定</el-button>
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="handleUpdateCancel">取消</el-button>
            </div>
        </el-dialog>
        <!--导入弹框-->
        <el-dialog title="导入库位信息" id="importFile" :visible.sync="importFileVisible" size="tiny"  :lock-scroll="false">
            <el-upload class="upload-demo"  :action="action" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" :on-preview="handlePreview" :on-remove="handleRemove" :file-list="fileList" :before-upload="beforeAvatarUpload" :on-success="handleAvatarSuccess">
                <el-button size="mini" type="danger">点击上传</el-button>
                <div slot="tip" class="el-upload__tip">只能上传excel文件</div>
            </el-upload>
        </el-dialog>
    </div>
</template>
<script>
       export default {
        data() {
            return {
                // 查询表单
                whPositionForm:{
                    roomCode:"",
                    roomName:"",
                    areaName:"",
                    areaCode:"",
                    name:"",
                    code:"",
                    status:""
                },
                whPositionData:[],
                statusLists:[],   //当前状态下拉列表
                labelWidth:"100px",
                addWhPositionForm:{
                    roomId:"",
                    roomCode:"",
                    roomName:"",
                    storageSectionId:"",
                    areaCode:"",
                    areaName:"",
                    name:"",
                    code:"",
                    remark:"",
                    status:false,
                    storageBinValueList:[]
                },
                wareHouseMesgLists:[],   //新增弹窗库房信息
                storageSectionMesgLists:[],  // 新增弹窗库房库区信息
                addWhPositionData:[],// 库位列表
                addSureFlag:false,   // 新增的弹窗确定（不退出）
                updateWhPositionForm:{
                    roomId:"",
                    roomCode:"",
                    roomName:"",
                    storageSectionId:"",
                    areaCode:"",
                    areaName:"",
                    name:"",
                    code:"",
                    remark:"",
                    status:false
                },
                loading:false,
                disabled:false,


                //弹窗
                dialogForm1Visible:false,
                dialogForm2Visible:false,
                // 分页
                isPaging:false,
                pageIndex:1,    //当前页（必传）
                pageSize :10,   //每页多少条
                totalNumber: 20,
                totalPage:2,
                
                //查询禁用
                selectDisabled:false,

                action:"",
                fileList: [],
                importFileVisible:false
            };
        },
       //进入页面立即运行此方法
       mounted: function () {
            var _this = this;
            _this.$store.commit('currentActive', 'WarehousePosition');
            // //ajax前后查询按钮禁用
            // $(".selectAll").ajaxStart(function(){
            //     _this.selectDisabled=true;
            // });
            // $(".selectAll").ajaxStop(function(){
            //     _this.selectDisabled=false;
            // });

            
            // 上传地址
            _this.action=_this.iwm_service+"StorageBin/import";


            _this.dropDownValue();// 当前状态下拉列表
            //_this.querywhPosition();    //表单查询
       },
        methods:{
          // 列表显示的状态转化
          stateChange(row) {
            if (row.status === 1) {
              return '启用'
            } else  {
              return '禁用'
            }
          },
            // 当前状态下来列表
            dropDownValue(){
                var _this=this;
                var tmp=["status"];
                $.ajax({
                    type:'POST',
                    url:_this.iwm_service+'/metadata/getPullDownList',
                    cache:false,
                    data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType:"application/json;charset=utf-8",
                    success:function(data){
                        if(data.success){
                            _this.statusLists=data.data.status;
                        }else{
                            _this.common.errorTip(data.message);
                        }
                    }
                })
            },
            //查询库位列表
            querywhPosition(){
                var _this=this;
                _this.loading=true;
                var tmp={
                    roomName:_this.whPositionForm.roomName,
                    roomCode:_this.whPositionForm.roomCode,
                    areaName:_this.whPositionForm.areaName,
                    areaCode:_this.whPositionForm.areaCode,
                    name:_this.whPositionForm.name,
                    code:_this.whPositionForm.code,
                    status:_this.whPositionForm.status,
                    pageIndex:_this.pageIndex,
                    pageSize:_this.pageSize
                };
                _this.selectDisabled=true;
                $.ajax({
                    type: 'POST',
                    url: _this.iwm_service+"store/queryPage",
                    cache: false,
                    data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",
                    success: function (data) {
                        if (data.success) {
                            _this.loading=false;
                            _this.isPaging=true;
                            _this.totalPage=data.data.totalPage;
                            _this.totalNumber=data.data.totalNumber;
                            _this.whPositionData=data.data.dataList;
                        }else{
                            _this.common.errorTip(data.message)
                        }
                        _this.selectDisabled=false;
                    }
                });
            },
            //导入按钮
            importFile(){
                var _this=this;
                _this.importFileVisible = true;
                _this.fileList=[];

            },
             //上传文件之前的钩子
            beforeAvatarUpload(file) {
                // console.log(file);
                const isExcel2007 = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
                const isExcel2003 = file.type === 'application/vnd.ms-excel';
                if (!isExcel2007 && !isExcel2003) {
                    this.$message.error('只能上传excel文件!');
                }
                return isExcel2007 || isExcel2003 ;
            },
            // 文件上传成功时的钩子
             handleAvatarSuccess(res, file) {
                 var _this=this;
                if(res.success){
                    _this.common.successTip("上传成功！");
                    _this.importFileVisible = false;
                    //上传成功刷新页面
                    _this.querywhPosition(_this.pageIndex,_this.pageSize); 
                }else{
                    _this.fileList=[];
                    _this.common.errorTip(res.message);
                }
                // console.log(res);
                // console.log(file);
            },
            handleRemove(file, fileList) {
                console.log(file, fileList);
            },
            handlePreview(file) {
                console.log(file);
            },
            // 新增弹窗库房信息
            wareHouseDropDown(){
                var _this=this;
                $.ajax({
                    type:'GET',
                    url:_this.iwm_service+'common/storeRoomSee?legalpersonCode=',
                    cache:false,
                    // data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType:"application/json;charset=utf-8",
                    success:function(data){
                        if(data.success){
                            _this.wareHouseMesgLists=data.data;
                        }else{
                            _this.common.errorTip(data.message);
                        }
                    }
                })
            },
            // 弹窗的库房编码=====》库房名称及描述
            selectedroomCode(){
                var _this = this;
                for(var i=0;i<_this.wareHouseMesgLists.length;i++){
                    if(_this.addWhPositionForm.roomCode == _this.wareHouseMesgLists[i].code){
                        _this.addWhPositionForm.roomName=_this.wareHouseMesgLists[i].name;
                        _this.addWhPositionForm.roomId=_this.wareHouseMesgLists[i].id;
                        _this.storageSectionDropDown();
                    }
                }
                _this.addWhPositionForm.areaCode = null;
                _this.addWhPositionForm.areaName = null;
                _this.addWhPositionData = [];
            },
            // 新增弹窗库区信息
            storageSectionDropDown(){
                var _this=this;
                $.ajax({
                    type:'GET',
                    url:_this.iwm_service+'common/storeAreaSee?storeRoomCode='+_this.addWhPositionForm.roomCode,
                    cache:false,
                    // data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType:"application/json;charset=utf-8",
                    success:function(data){
                        if(data.success){
                            _this.storageSectionMesgLists=data.data;
                        }else{
                            _this.common.errorTip(data.message);
                        }
                    }
                })
            },
            // 弹窗的库区编码=====》库区名称及描述
            selectedareaCode(){
                var _this = this;
                for(var i=0;i<_this.storageSectionMesgLists.length;i++){
                    if(_this.addWhPositionForm.areaCode == _this.storageSectionMesgLists[i].code){
                        _this.addWhPositionForm.areaName=_this.storageSectionMesgLists[i].name;
                        _this.addWhPositionForm.storageSectionId=_this.storageSectionMesgLists[i].id;
                        _this.wareHousePDropDown();
                    }
                }                
                _this.addWhPositionData = [];
            },
            // 新增弹窗库位列表
            wareHousePDropDown(){
                var _this=this;
                var tmp={roomId:_this.addWhPositionForm.roomId,storageSectionId:_this.addWhPositionForm.storageSectionId}
                $.ajax({
                    type:'GET',
                    url:_this.iwm_service+'common/store?areaCode='+_this.addWhPositionForm.areaCode,
                    cache:false,
                    // data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType:"application/json;charset=utf-8",
                    success:function(data){
                        if(data.success){
                            _this.addWhPositionData=data.data;
                        }else{
                            _this.common.errorTip(data.message);
                        }
                    }
                })
            },
            //新增库位信息
            createNew(){
                var _this=this;
                _this.wareHouseDropDown();
                _this.dialogForm1Visible=true; 
                if(this.$refs['addWhPositionForm']) {
                    this.$refs['addWhPositionForm'].resetFields();
                }
                _this.addWhPositionForm.roomId="";
                _this.addWhPositionForm.roomCode="";
                _this.addWhPositionForm.roomName="";
                _this.addWhPositionForm.storageSectionId="";
                _this.addWhPositionForm.areaName="";
                _this.addWhPositionForm.areaCode="";
                // _this.addWhPositionForm.name="";
                // _this.addWhPositionForm.code="";
                // _this.addWhPositionForm.status=false;
                // _this.addWhPositionForm.remark="";
                _this.addWhPositionForm.storageBinValueList=[];
                _this.addWhPositionData=[];
            },
            // 新建窗口中的新增按钮
            handleAddCreate(){
                var _this = this;
                _this.addWhPositionData.push({
                    code:"",
                    name:"",
                    status:true
                });
            },
            // 新建窗口 的删除
            handleAddDel(){
              $.ajax({
                type: 'GET',
                url: _this.iwm_service+"store/remove?code"+_this.addWhPositionData.code,
                cache: false,
                // data:JSON.stringify(code),
                dataType:'JSON',
                contentType: "application/json;charset=utf-8",
                success: function (data) {
                  if (data.success) {
                    _this.common.successTip("保存成功！");
                    if(_this.addSureFlag){
                      _this.dialogForm1Visible=false;
                    }
                  }else{
                    _this.common.errorTip(data.message);
                  }
                }
              });
              _this.wareHousePDropDown();
            },
            // 新建窗口中的保存按钮
            handleAddSave(){
                var _this = this;
                _this.addSureFlag = false;
                _this.handleAddSaveWhPosition();
            },
            // 新建窗口中的保存并退出按钮
            handleAddSAE(){
                var _this = this;
                _this.addSureFlag = true;
                _this.handleAddSaveWhPosition();
            },
            //新建保存
            handleAddSaveWhPosition(){
                var _this=this;
                _this.addWhPositionForm.storageBinValueList = _this.addWhPositionData;
                _this.$refs["addWhPositionForm"].validate((valid) => {
                    if (valid) {
                        if(_this.addWhPositionForm.storageBinValueList && _this.addWhPositionForm.storageBinValueList.length){
                            var contentList=[];
                            for(var i=0;i<_this.addWhPositionForm.storageBinValueList.length;i++){
                                contentList.push(
                                    {
                                        roomCode:_this.addWhPositionForm.roomCode,
                                        areaCode:_this.addWhPositionForm.areaCode,
                                        name:_this.addWhPositionForm.storageBinValueList[i].name,
                                        code:_this.addWhPositionForm.storageBinValueList[i].code,
                                    }
                                );
                            }
                            var tmp={roomCode:_this.addWhPositionForm.roomCode,areaCode:_this.addWhPositionForm.areaCode,store:_this.addWhPositionData};
                            $.ajax({
                                type: 'POST',
                                url: _this.iwm_service+"store/add",
                                cache: false,
                                data:JSON.stringify(tmp),
                                dataType:'JSON',
                                contentType: "application/json;charset=utf-8",
                                success: function (data) {
                                    if (data.success) {
                                        _this.common.successTip("保存成功！");
                                        if(_this.addSureFlag){
                                            _this.dialogForm1Visible=false;
                                        }
                                        _this.querywhPosition();
                                    }else{
                                        _this.common.errorTip(data.message);
                                    }
                                }
                            });
                        }else{
                            _this.common.errorTip("库位明细不能为空，请新增！");
                        }
                    } else {
                        _this.common.errorTip("存在未填写的必填项！");
                        return false;
                    }
                });
            },
            // 操作启用禁用
            handleStatus(index, row){
                var _this=this;
                if(row.status){
                    row.status = false;
                }else{
                    row.status = true;
                }
                var tmp={id: row.id,status: row.status}; 
                $.ajax({
                    type: 'POST',
                    url: _this.iwm_service+"store/updateStatus",
                    cache: false,
                    data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",
                    success: function (data) {
                        if (data.success) {
                            // 当前状态的显示
                            if(row.status){
                                row.statusName = "启用";
                                _this.common.successTip("启用成功！");
                            }else{
                                row.statusName = "禁用";
                                _this.common.successTip("禁用成功！");
                            }
                        }else
                            _this.common.errorTip(data.message);
                    }
                });
            },
            //点击修改
            handleUpdate(index,row){
                var _this=this;
                _this.dialogForm2Visible=true;
                if(this.$refs['updateWhPositionForm']) {
                    this.$refs['updateWhPositionForm'].resetFields();
                 }
                _this.updateWhPositionForm.id = row.id;
                _this.updateWhPositionForm.name = row.name;
                _this.updateWhPositionForm.code = row.code;
                _this.updateWhPositionForm.areaName = row.areaName;
                _this.updateWhPositionForm.areaCode = row.areaCode;
                _this.updateWhPositionForm.areaRemark = row.areaRemark;
                _this.updateWhPositionForm.roomCode = row.roomCode;
                _this.updateWhPositionForm.roomName = row.roomName;
                _this.updateWhPositionForm.roomRemark = row.roomRemark;
            },
            //修改保存
            handleUpdateSave(){
                var _this=this;
                _this.$refs["updateWhPositionForm"].validate((valid) => {
                    if (valid) {
                        var tmp={
                            code:_this.updateWhPositionForm.code,
                            name:_this.updateWhPositionForm.name
                            };
                        $.ajax({
                            type: 'POST',
                            url: _this.iwm_service+"store/update",
                            cache: false,
                            data:JSON.stringify(tmp),
                            dataType:'JSON',
                            contentType: "application/json;charset=utf-8",
                            success: function (data) {
                                if (data.success) {
                                    _this.common.successTip("修改成功！");
                                    _this.dialogForm2Visible=false;
                                    _this.querywhPosition();
                                }else
                                    _this.common.errorTip(data.message);
                            }
                        });
                    } else {
                        _this.common.errorTip("存在未填写的必填项！");
                        return false;
                    }
                });
            },
            //修改取消
            handleUpdateCancel(){
                var _this=this;
                _this.dialogForm2Visible=false;
            },
            //   分页
            handleSizeChange(val) {
                var _this=this;
                _this.pageSize=val;
                _this.querywhPosition();

            },
            //点击页码分页查询点击事件
            handleCurrentChange(val) {
                var _this=this;
                _this.pageIndex=val;
                _this.querywhPosition();
            },
            // // ===================================
            // successTip(p) {     //成功时的提示信息
            //     this.$notify({
            //         title: '成功',
            //         message: p,
            //         type: 'success'
            //     });
            // },
            // errorTip(p) {     //错误提示
            //     this.$notify.error({
            //         title: '错误',
            //         message: p
            //     });
            // }

        }
    }
</script>


